<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>ECharts</title>
    <script src="../plugins/echarts/echarts.js"></script>
</head>
<body>
<div id="main" style="width: 600px;height:400px;"></div>

<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));
    // 指定图表的配置项和数据
    var option = {
        title : {
            text: '商品类目销售分析',
            subtext: '这是个例子',
            x:'center'
        },
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            orient: 'vertical',
            left: 'left',
            data: ['水果','蔬菜','家电','数码','服装']
        },
        series : [
            {
                name: '销售量',
                type: 'pie',
                radius : '35%',
                center: ['30%', '50%'],
                data:[
                    {value:335, name:'水果'},
                    {value:310, name:'蔬菜'},
                    {value:234, name:'家电'},
                    {value:135, name:'数码'},
                    {value:1548, name:'服装'}
                ],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            },
            {
                name: '销售额',
                type: 'pie',
                radius : '35%',
                center: ['80%', '50%'],
                data:[
                    {value:2003, name:'水果'},
                    {value:2310, name:'蔬菜'},
                    {value:4434, name:'家电'},
                    {value:1125, name:'数码'},
                    {value:1448, name:'服装'}
                ],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
</script>

</body>
</html>